﻿using System;
using UnityEngine;

namespace Z1029.PhiPlayer.OpenSource
{
    public class NotesManager : MonoBehaviour
    {
        public Note click, drag, hold, flick;

        private void Start()
        {
        }

        public Note InstantiateNote(NoteType type, Note.NoteData data, JudgementLine judgeline, Note.Direction dir)
        {
            Note n = null;
            switch (type)
            {
                case NoteType.Click://1
                    n = Instantiate(click);
                    break;
                case NoteType.Flick://4
                    n = Instantiate(flick);
                    break;
                case NoteType.Hold://3
                    n = Instantiate(hold);
                    break;
                case NoteType.Drag://2
                    n = Instantiate(drag);
                    break;
            }
            n.noteData = data;
            n.direction = dir;
            n.transform.parent = judgeline.transform;

            n.name = "Note - " + data.time;
            n.judgeline = judgeline;

            n.Awake();
            n.Start();

            return n;
        }
    }
}